﻿using System.Linq;
using ExtendedMvc.WebTest.Model.Entities;

namespace ExtendedMvc.WebTest.Model {
	public class UserRepository : LogicalRepository<User>, IUserRepository {
		public User GetByLogin(string login, bool includeDeleted = false) {
			return this.All(includeDeleted).SingleOrDefault(u => u.Login == login);
		}

		public static UserRepository Create() {
			var users = new UserRepository();
			users.Add(new User { Name = "User1", Login = "Login1", Password = "Senha1", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User2", Login = "Login2", Password = "Senha2", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User3", Login = "Login3", Password = "Senha3", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User4", Login = "Login4", Password = "Senha4", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User5", Login = "Login5", Password = "Senha5", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User6", Login = "Login6", Password = "Senha6", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User7", Login = "Login7", Password = "Senha7", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User8", Login = "Login8", Password = "Senha8", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User9", Login = "Login9", Password = "Senha9", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User10", Login = "Login10", Password = "Senha10", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User11", Login = "Login11", Password = "Senha11", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User12", Login = "Login12", Password = "Senha12", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User13", Login = "Login13", Password = "Senha13", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User14", Login = "Login14", Password = "Senha14", PasswordStatus = PasswordStatus.Valid });
			users.Add(new User { Name = "User15", Login = "Login15", Password = "Senha15", PasswordStatus = PasswordStatus.Valid });
			return users;
		}
	}
}
